'''
TIME_MAT = {}
'''

class Location(object):

	LOCATION_ID = 0

	def __init__(self, php_id = None, php_assoc_id = None, size = 0, wait=0, assoc_loc_id = None):
		self.php_id = php_id
		self.php_assoc_id = php_assoc_id
		
		self.id = self.__class__.LOCATION_ID
		self.__class__.LOCATION_ID += 1
		self.assoc_loc_id = assoc_loc_id	# id of associated location

		self.size = size
		self.wait = wait

	def getAssocLoc(self):
		return self.assoc_loc_id

	def setAssocID(self, assoc_loc_id):
		self.assoc_loc_id = assoc_loc_id

	def getID(self):
		return self.id

	def getPHPID(self):
		return self.php_id

	def getPHPAssocID(self):
		return self.php_assoc_id

	def getSize(self):
		return self.size

	def getWait(self):
		return self.wait

	def increaseWait(self, time):
		self.wait += time

	def isCountable(self):
		return self.getSize() < 0 or (self.getSize() > 0 and self.getAssocLoc() == None)

	def __lt__(self, other):
		return self.size < other.getSize()

	def __le__(self, other):
		return self.size <= other.getSize()

	def __eq__(self, other):
		return self.size == other.getSize()

	def __str__(self):
		#return "%d : %s\tsize: %d\twait: %d" % (self.id, self.assoc_loc_id, self.size, self.wait)
		return "%d %s : %s %s" % (self.id, str(self.php_id), str(self.assoc_loc_id), str(self.php_assoc_id))